#ifndef GAME_H
#define GAME_H

#include "widget.h"
#include "gamewindow.h"

#include "gameserver.h"
#include "gameclient.h"


class Game : public QObject
{
    Q_OBJECT
public:
    Game();
    ~Game();

signals:
    // void gameReset(const QString& why);

private slots:
    void startServer(quint16 port);
    void startClient(const QHostAddress& serverAddress, quint16 serverPort);

    void onClientStopping(const QString& why);
    void startGame();

private:
    void showWidgets(bool initial);
    void initConnections();

    void stopServer();
    void stopClient();

    // windows
    Widget *fw;
    GameWindow *gw;

    // server / client
    GameServer *server;
    GameClient *client;

    QThread *serverThread;
};

#endif // GAME_H
